<%@ page contentType="text/html;charset=UTF-8" import="java.util.Enumeration" language="java"%>
<!DOCTYPE html>
<html>
<head>
<title>隐含对象pageContext</title>
</head>
<body>
  pageContext是PageContext类的实例
  <br>
  <%
      out.print("为隐含对象pageContext设置属性<br>");
      String attr = "team", val = "work";
      pageContext.setAttribute(attr, val);
      out.print("获取为pageContext设置的属性<br>");
      Enumeration<String> names = pageContext.getAttributeNamesInScope(PageContext.PAGE_SCOPE);
      while (names.hasMoreElements()) {
          String name = names.nextElement();
          if (name.equals(attr)) {
              Object value = pageContext.getAttribute(name);
              out.print(name + "：" + value + "<br>");
          }
      }
      out.print("为隐含对象application设置属性");
      application.setAttribute("attr", "val");
  %>
  <form action="pageContext2.jsp" method="post">
    <input type="hidden" name="<%=attr%>" value="<%=val%>">
    <input type="submit" value="pageContext2">
  </form>
</body>
</html>
